package com.system.log.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.system.log.dao.LogRepository;
import com.system.log.entity.Log;

@Service
@Transactional
public  class LogService implements ILogService {
	@Autowired	
	private LogRepository logRepository;
	
	public void saveOrUpdate(Log log) {
		logRepository.save(log);
	}
	public void delete(Log employee) {
		logRepository.delete(employee);
	}
	public void delete(List<Long> ids) {
		List<Log> employee =  (List<Log>) logRepository.findAll(ids);
		if(employee!=null) {
			logRepository.delete(employee);
		}
	}
	@Transactional(readOnly = true)
	public Log findOne(Long logId) {
		return logRepository.findOne(logId);
	}
	@Transactional(readOnly = true)
	public List<Log> findAll(){
		return (List<Log>) logRepository.findAll();
	}
	//动态条件查询
	@Transactional(readOnly = true)
	public Page<Log> findAll(Specification<Log> spec, Pageable pageable){
		return logRepository.findAll(spec, pageable);
	}

	
		
}
